package com.sanpu.kxe.common.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.sanpu.kxe.R;

/**
 * 自定义
 * Created by Administrator on 2018/5/17.
 */

public class ExcelTextView extends AppCompatTextView {

    private Context mContext;

    private int strokWidth = 1;

    public ExcelTextView(Context context) {
        super(context);
        this.mContext = context;
    }

    public ExcelTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.mContext = context;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(ContextCompat.getColor(mContext, R.color.color_base));
//        canvas.drawLine(0,0,this.getWidth()-strokWidth,0, paint);
//        canvas.drawLine(0,0,0,this.getHeight()-strokWidth, paint);
//        canvas.drawLine(this.getWidth()-strokWidth,0,this.getWidth()-strokWidth,this.getHeight()-strokWidth, paint);
//        canvas.drawLine(0,this.getHeight()-strokWidth,this.getWidth()-strokWidth,this.getHeight()-strokWidth, paint);
        canvas.drawLine(0,0,this.getWidth()-strokWidth,this.getHeight()-strokWidth,paint);
        super.onDraw(canvas);
    }
}
